﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ContosoUniversity.Models
{
    public class Student:Person
    {
        //public int ID { get; set; }

        //[Required]
        ////[RegularExpression(@" ^[A - Z] +[a - zA - Z'' - '\s]*$")]
        //[StringLength(50)]
        //[Display(Name ="Last Name")]
        //public string LastName { get; set; }

        //[Required]
        ////[RegularExpression(@" ^[A - Z] +[a - zA - Z'' - '\s]*$")]
        //[StringLength(50,ErrorMessage ="Cannot be longer than 50 characters!")]
        //[Column("FirstName")]
        //[Display(Name ="First Name")]
        //public string FirstMidName { get; set; }

        [DataType(DataType.Date)]
        [DisplayFormat(DataFormatString = "{0:yyyy:MM:dd}", ApplyFormatInEditMode = true)]
        [Display(Name = "Enrollment Date")]
        public DateTime EnrollmentDate { get; set; }

        //[Display(Name ="Full Name")]
        //public string FullName
        //{
        //    get
        //    {
        //        return LastName + "," + FirstMidName;
        //    }
        //}

        /*The Enrollments property is a navigation property. 
         * Navigation properties hold other entities that are related to this entity. 
         * In this case, the Enrollments property of a Student entity will hold all of the Enrollment entities that are related to that Student entity. 
         * In other words, if a given Student row in the database has two related Enrollment rows 
         * (rows that contain that student's primary key value in their StudentID foreign key column), 
         * that Student entity's Enrollments navigation property will contain those two Enrollment entities.
         * 
        */


        public virtual ICollection<Enrollment> Enrollments { get; set; }
    }
}
 